Wait for sensor IfElseSubLoop to become active
Print Start YAAT Test

If sensor IfElseSubLoop is active
    Print -- IfElseSubLoop active 1
Else
    Print -- IfElseSubLoop inactive 1
Endif

Loop
Print Loop point

If sensor IfElseSubLoop is active
    Print -- IfElseSubLoop active 2
    If sensor IfElseSubLoop is inactive
        Print ---- IfElseSubLoop inactive 3
    Else
        Print ---- IfElseSubLoop active 3
        CallSub s2
        Print ---- returned from s2
    Endif
Endif

Repeat if sensor IfElseSubLoop is active

Print Done
Stop if sensor IfElseSubLoop is inactive

Sub s1
Print >>>> sub 1 starts
Print >>>> sub 1 stops
EndSub s1

Sub s2
Print >>>> sub 2 starts
Print >>>> call s1
CallSub s1
Print >>>> back from S1 in s2
Print >>>> sub 2 stops
EndSub s2
